package com.example.controller;

import com.example.pojo.entity.Orders;
import com.example.pojo.entity.Resume;
import com.example.service.ResumeService;
import com.example.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("resume-find")
public class ResumeController {
    @Autowired
    private ResumeService resumeService;

    @GetMapping("get-resume")
    public Result getAllResume(){
        List<Resume> resumeList = resumeService.selectResume();
        return new Result(200,"查询成功",resumeList);
    }

    @GetMapping("find-resume")
    public Result getAlreadyBuyResume(Integer jsId){
        List<Orders> buyList = resumeService.findBuyResume(jsId);
        return new Result(200,"查询成功",buyList);
    }

    @PostMapping("download/{name}/{jsId}")
    public Result getDownloadResume(@PathVariable("name") String name,@PathVariable("jsId") Integer jsId){
        log.info("准备下载简历");
        String qnaddres = resumeService.getAddressIfBuy(name,jsId);
        return new Result(200,"下载确认成功",qnaddres);
    }
}
